//
//  WPCredentialsCollectionViewCell.m
//  wobingwoyi
//
//  Created by WGP on 2016/11/16.
//  Copyright © 2016年 WGP. All rights reserved.
//

#import "WPCredentialsCollectionViewCell.h"

@interface WPCredentialsCollectionViewCell ()

@property(nonatomic,strong)UIImageView *imageView;

@end
@implementation WPCredentialsCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame])
    {
        [self imageView];
    }
    return self;
}

-(UIImageView *)imageView
{
    if (_imageView == nil)
    {
        _imageView = [[UIImageView alloc] init];
        _imageView.contentMode = UIViewContentModeScaleAspectFill;
        _imageView.clipsToBounds = YES;
        [self.contentView addSubview:_imageView];
        
        [_imageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self.contentView);
        }];
    }
    return _imageView;
}

-(void)setUrl:(NSString *)url
{
    _url = url;
    
    [self.imageView sd_setImageWithURL:[NSURL URLWithString:self.url] placeholderImage:[UIImage imageNamed:@"noImages"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
       
        //可以拿到下载好的图片
    }];
}

@end
